<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet"href="/css/plat-style.css">
    <style>
        thead tr th{text-align: center!important;font-weight: bold!important;}
        tr td{text-align: center!important;}
        .layui-table img {
            width: auto;
            height: auto;
            max-width: 100% !important;
            max-height: 100%;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-container" style="padding-bottom: 50px">
                        <div class="layui-col-md12">
                            <div class="layui-col-md4 layui-col-md-offset10">
                                <div class="layui-col-sm8">
                                    <a href="javaScript:;" onclick="history.go(-1)" class="layui-btn layui-btn" type="button">返回上一页</a>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-xs12">&nbsp;</div>
                    </div>
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>图片</th>
                            <th>名称</th>
                            <th>类型</th>
                            <th>显示位置</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list}" var="l">
                            <tr>
                                <td width="30%">
                                    <c:if test="${l.position==1}">
                                        <img src="${l.icon}" style="width: 225px;height: 84px">
                                    </c:if>
                                    <c:if test="${l.position==2}">
                                        <img src="${l.icon}" style="width: 84px;height: 120px">
                                    </c:if>
                                    <c:if test="${l.position==3}">
                                        <img src="${l.icon}" style="width: 122px;height: 51px">
                                    </c:if>
                                    <c:if test="${l.position==4 || l.position==5}">
                                        <img src="${l.icon}" style="width: 61px;height: 74px">
                                    </c:if>
                                </td>
                                <td width="15%">${l.name}</td>
                                <td width="15%">${l.eventName}</td>
                                <td>
                                    <c:if test="${l.position==1}">上方横图</c:if>
                                    <c:if test="${l.position==2}">左侧竖图</c:if>
                                    <c:if test="${l.position==3}">中间横图</c:if>
                                    <c:if test="${l.position==4}">右下左图</c:if>
                                    <c:if test="${l.position==5}">右下右图</c:if>
                                </td>
                                <td width="10%">
                                    <button data-id="${l.id}" data-position="${l.position}" data-type="editThis" type="button"
                                            class="layui-btn layui-btn-sm layui-btn-normal editThis">编辑</button>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function(){
        var $ = layui.$,
            form = layui.form,
            element = layui.element,
            layer = layui.layer;
        form.render('select');
        element.render();

        var active = {
            editThis: function (id,position) {
                layer.open({
                    title:'新增/编辑图标',
                    type: 2,
                    area: ['600px', '500px'],
                    content: '/app/dailyEdit?id='+id+'&position='+position
                });
            }
        };
        $('.editThis').on('click', function(){
            var id = $(this).data('id');
            var position = $(this).data('position');
            var type = 'editThis';
            active[type] && active[type].call(this,id,position);
        });
    });
</script>
</body>
</html>